package com.jing.product.service.impl;

import com.jing.product.domain.dto.ProductAttributeDTO;
import com.jing.product.domain.po.ProductAttribute;
import com.jing.product.domain.vo.ProductAttributeVO;
import com.jing.product.mapper.ProductAttributeMapper;
import com.jing.product.service.ProductAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：HaoYunde
 * @Package：com.jing.product.service.impl
 * @Project：Jing
 * @name：ProductAttributeServiceImpl
 * @Date：2024/5/24 20:57
 */
@Service
public class ProductAttributeServiceImpl implements ProductAttributeService {
    @Autowired
    private ProductAttributeMapper mapper;

    @Override
    public List<ProductAttributeVO> findProductAttribute(Integer id) {
        return  mapper.findProductAttribute(id);
    }

    @Override
    public void add(ProductAttributeDTO productAttributeDTO) {
        int flag=mapper.add(productAttributeDTO);
        if (flag==0){
            throw new RuntimeException("添加失败");
        }
    }

    @Override
    public List<ProductAttributeVO> findProductParm(Integer id) {
        return  mapper.findProductParm(id);
    }

    @Override
    public void update(ProductAttributeDTO productAttributeDTO) {
        int flag=mapper.update(productAttributeDTO);
        if (flag==0){
            throw new RuntimeException("修改失败");
        }
    }
}
